package com.heima.comment.comtroller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "app端用户评论api",tags = "app端用户评论api")
@RestController
@RequestMapping("/api/v1")
public class CommentController {
    @Autowired
    CommentService commentService;
@Autowired
    CommentRepayService commentRepayService;
    @PostMapping("/comment/save")
    public ResponseResult saveComment(@RequestBody CommentSaveDTO dto){
        return commentService.saveComment(dto);
    }
    @PostMapping("/comment/like")
    public ResponseResult like(@RequestBody CommentLikeDTO dto){
        return commentService.like(dto);
    }
    @PostMapping("comment/load")
    public ResponseResult findByArticleId(@RequestBody CommentDTO dto){
        ResponseResult result = commentService.findByArticleId(dto);
        return result;
    }
    @PostMapping("comment_repay/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDTO dto){
        return commentRepayService.loadCommentRepay(dto);

    }
    @PostMapping("comment_repay/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDTO dto){
        return commentRepayService.saveCommentRepay(dto);

    }
    @PostMapping("comment_repay/like")
    public ResponseResult saveCommentRepayLike(@RequestBody CommentRepayLikeDTO dto){
        return commentRepayService.saveCommentRepayLike(dto);

    }
}
